package com.booking.springrestful.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 审批表，用于记录审批流程相关信息
 * @TableName approvaltable
 */
@TableName(value ="approvaltable")
@Data
public class Approvaltable implements Serializable {
    /**
     * 主键，自增整数，唯一标识每条记录
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 审批状态，如待审批、已审批等
     */
    private String approvastatus;

    /**
     * 审批结果，如同意、拒绝等
     */
    private String approvalresult;

    /**
     * 审批备注，用于存储审批附加说明或备注
     */
    private String approvalnote;

    /**
     * 发起人，存储发起审批请求的人员姓名
     */
    private String initiator;

    /**
     * 审批人，存储负责审批的人员姓名
     */
    private String approver;

    /**
     * 创建时间，记录请求创建的时间
     */
    private Date createdat;

    /**
     * 更新时间，记录最后一次更新的时间
     */
    private Date updatedat;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Approvaltable other = (Approvaltable) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getApprovastatus() == null ? other.getApprovastatus() == null : this.getApprovastatus().equals(other.getApprovastatus()))
            && (this.getApprovalresult() == null ? other.getApprovalresult() == null : this.getApprovalresult().equals(other.getApprovalresult()))
            && (this.getApprovalnote() == null ? other.getApprovalnote() == null : this.getApprovalnote().equals(other.getApprovalnote()))
            && (this.getInitiator() == null ? other.getInitiator() == null : this.getInitiator().equals(other.getInitiator()))
            && (this.getApprover() == null ? other.getApprover() == null : this.getApprover().equals(other.getApprover()))
            && (this.getCreatedat() == null ? other.getCreatedat() == null : this.getCreatedat().equals(other.getCreatedat()))
            && (this.getUpdatedat() == null ? other.getUpdatedat() == null : this.getUpdatedat().equals(other.getUpdatedat()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getApprovastatus() == null) ? 0 : getApprovastatus().hashCode());
        result = prime * result + ((getApprovalresult() == null) ? 0 : getApprovalresult().hashCode());
        result = prime * result + ((getApprovalnote() == null) ? 0 : getApprovalnote().hashCode());
        result = prime * result + ((getInitiator() == null) ? 0 : getInitiator().hashCode());
        result = prime * result + ((getApprover() == null) ? 0 : getApprover().hashCode());
        result = prime * result + ((getCreatedat() == null) ? 0 : getCreatedat().hashCode());
        result = prime * result + ((getUpdatedat() == null) ? 0 : getUpdatedat().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", approvastatus=").append(approvastatus);
        sb.append(", approvalresult=").append(approvalresult);
        sb.append(", approvalnote=").append(approvalnote);
        sb.append(", initiator=").append(initiator);
        sb.append(", approver=").append(approver);
        sb.append(", createdat=").append(createdat);
        sb.append(", updatedat=").append(updatedat);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}